<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="lib/vue.js"></script>
</head>
<body>
    <section id="app">
        <!--输入框 -->
        <header>
        <h1>小黑记事本</h1>
        <input placeholder="请输入任务" v-model="inputValue" @keyup.enter="add">
       
        </header>
    <!-- 列表区域 -->
    <section>
        <ul>
            <li v-for="(item,index) in list">
                <div>
                    <span>{{index+1}}</span>
                    <label>{{item}}</label>
                    <button @click="remove(index)">删除</button>
                </div>
            </li>
        </ul>
    </section>
  

    
<script>
var vm = new Vue({
    el:"#app",
    data:{
        list:["写代码","睡觉觉"],
        inputValue:"好好学习，天天向上"

    },
    methods:{
        add(){
            this.list.push(this.inputValue)
        },
        remove(index){
            this.list.splice(index,1)
        }

    }
})
</script>
</body>
</html>